home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / quicktime vr / vrscript / feature files / vrpreferences.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  3.7 KB  |  135 lines

  1. //////////
  2. //
  3. //    File:        VRPreferences.h
  4. //
  5. //    Contains:    Header file for VRScript preferences management.
  6. //
  7. //    Written by:    Tim Monroe
  8. //
  9. //    Copyright:    © 1999 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //    Change History (most recent first):
  12. //
  13. //       <1>         06/02/99        rtm        first file
  14. //       
  15. //////////
  16.  
  17. #pragma once
  18.  
  19. //////////
  20. //
  21. // header files
  22. //       
  23. //////////
  24.  
  25. #include "ComApplication.h"
  26. #include "VRScript.h"
  27.  
  28. #if TARGET_OS_WIN32
  29. #include <winreg.h>
  30. #endif
  31.  
  32. #if TARGET_OS_MAC
  33. #include <Folders.h>
  34. #endif
  35.  
  36.  
  37. //////////
  38. //
  39. // constants
  40. //
  41. //////////
  42.  
  43. // preferences dialog item IDs
  44. #define kPreferencesDialogID            2000
  45.  
  46. #define kPrefsButtonDone                1
  47. #define kPrefsButtonCancel                2
  48. #define kPrefsRadioPromptUser            3
  49. #define kPrefsRadioDirOfMovieFile        4
  50. #define kPrefsRadioDirOfApplication        5
  51. #define kPrefsRadioUserSpecifiedPath    6
  52. #define kPrefsTextEditFilePath            7
  53.  
  54. #define kPrefsRadioFileNamePlusVRS        8
  55. #define kPrefsRadioUserSpecifiedName    9
  56. #define kPrefsTextEditFileName            10
  57.  
  58. #define kPrefsFilePathUserItem            13
  59. #define kPrefsFileNameUserItem            14
  60.  
  61.  
  62. // values for fScriptLocType field of a preferences record
  63. enum {
  64.     kVRPrefs_PromptUser            = (UInt32)0,        // prompt the user for the location and name
  65.     kVRPrefs_DirOfMovieFile        = (UInt32)1,        // script file is in same directory as the movie file
  66.     kVRPrefs_DirOfApplication    = (UInt32)2,        // script file is in same directory as the application file
  67.     kVRPrefs_UserSpecifiedPath    = (UInt32)3            // script file is in a directory specified by an absolute pathname
  68. };
  69.  
  70. // values for fScriptNameType field of a preferences record
  71. enum {
  72.     kVRPrefs_FileNamePlusTXT    = (UInt32)0,        // script file name is the movie file basename with .txt suffix
  73.     kVRPrefs_UserSpecifiedName    = (UInt32)1            // script file name is specified by a relative pathname
  74. };
  75.  
  76. #if TARGET_OS_WIN32
  77. // registry database labels
  78. #define kVRPrefs_PrefsKeyName            "Software\\VRScript"
  79. #define kVRPrefs_ScriptLocTypeLabel        "Script directory selector"
  80. #define kVRPrefs_ScriptPathNameLabel    "Script directory pathname"
  81. #define kVRPrefs_ScriptNameTypeLabel    "Script file name selector"
  82. #define kVRPrefs_ScriptBaseNameLabel    "Script file basename"
  83. #endif
  84.  
  85. #if TARGET_OS_MAC
  86. #define kVRPrefs_PrefsFileName            "VRScript Preferences"
  87. #endif
  88.  
  89.  
  90. //////////
  91. //
  92. // data types
  93. //
  94. //////////
  95.  
  96. typedef struct VRScriptPrefsRec {
  97.     // the desired location of the script file
  98.     UInt32                        fScriptLocType;        // the desired location of the script file
  99.     Str255                        fScriptPathName;    // the user specified pathname of the script file directory
  100.     
  101.     // the desired name of the script file
  102.     UInt32                        fScriptNameType;    // the desired name of the script file
  103.     Str63                        fScriptBaseName;    // the user specified basename of the script file
  104.     
  105.     // application execution options (NOT YET IMPLEMENTED)
  106.     Boolean                        fTurboMode;            // use turbo execution mode?
  107.     Boolean                        fVerboseMode;        // use verbose mode?
  108.     
  109.     // preferences-management info
  110.     Boolean                        fPrefsFileExists;    // does a preferences file exist?
  111.     Boolean                        fPrefsDataDirty;    // have the stored preferences changed?
  112.     
  113. } VRScriptPrefsRec, *VRScriptPrefsPtr, **VRScriptPrefsHdl;
  114.  
  115.  
  116. //////////
  117. //
  118. // function prototypes
  119. //
  120. //////////
  121.  
  122. void                                VRPrefs_Init (void);
  123. void                                VRPrefs_Stop (void);
  124.  
  125. void                                VRPrefs_ShowPrefsDialog (void);
  126. static void                            VRPrefs_FillPrefsDialogFromPrefs (DialogPtr theDialog);
  127. static void                            VRPrefs_DrawPrefsDialogUserItem (WindowPtr theWindow, DialogItemIndex theItem);
  128.  
  129. static Boolean                        VRPrefs_PrefsFileExists (void);
  130. //static OSErr                        VRPrefs_GetPrefsFileFSSpec (OSType theCreator, OSType theFileType, FSSpec *theFSSpec);
  131. static OSErr                        VRPrefs_GetPrefsFileFSSpec (char *theFileName, FSSpecPtr theFSSpec);
  132.  
  133. static void                            VRPrefs_ReadPrefsFile (void);
  134. static void                            VRPrefs_UpdatePrefsFile (void);
  135.